//
//  WCErrorsAndWarningsGroup.m
//  WabbitCode
//
//  Created by William Towe on 1/23/09.
//  Copyright 2009 Revolution Software. All rights reserved.
//

#import "WCErrorsAndWarningsGroup.h"
#import "WCBuildMessage.h"


@implementation WCErrorsAndWarningsGroup
#pragma mark *** Subclass Overrides ***
- (NSString *)name {
	return NSLocalizedString(@"Errors & Warnings",@"Errors & Warnings");
}

- (NSImage *)icon {
	return [NSImage imageNamed:@"ErrorsAndWarnings16x16"];
}

- (BOOL)canRenameNode {
	return NO;
}

- (BOOL)canDeleteNode {
	return NO;
}

- (BOOL)isRootLevelGroup {
	return YES;
}

- (BOOL)canGetInfo {
	return NO;
}

- (void)encodeWithCoder:(NSCoder *)coder {
	
}

#pragma mark *** Public Methods ***
+ (id)errorsAndWarningsGroup; {
	return [super treeNodeWithNodeName:nil];
}

@dynamic numberOfErrors;
- (NSUInteger)numberOfErrors {
	NSUInteger count = 0;
	for (WCBuildMessage *bm in [self childNodes]) {
		count += [bm numberOfErrors];
	}
	return count;
}

@dynamic numberOfWarnings;
- (NSUInteger)numberOfWarnings {
	NSUInteger count = 0;
	for (WCBuildMessage *bm in [self childNodes]) {
		count += [bm numberOfWarnings];
	}
	return count;
}

@dynamic numberOfErrorsAndWarnings;
- (NSUInteger)numberOfErrorsAndWarnings {
	NSUInteger count = 0;
	for (WCBuildMessage *bm in [self childNodes]) {
		count += [bm numberOfErrorsAndWarnings];
	}
	return count;
}
@end
